<?php

require_once 'classes/ChargeCatagories.class.php';
$objChargeCatagories 	= new ChargeCatagories();
$arrobjChargeCatagories 	= $objChargeCatagories->fetchAllChargeCatagories();

// display( $arrobjDiagnosisTypes ); exit;

if( false == valArr( $arrobjChargeCatagories ) ) {
	echo '<h2>Charges catagories are not avaliable.</h2>';
} else {
?>
<link href="css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
<script src="js/plugins/dataTables/jquery.dataTables.js"></script>
<script src="js/plugins/dataTables/dataTables.bootstrap.js"></script>
<script src="js/bootstrap-confirmation.js" type="text/javascript"></script>
<script>
	$(document).ready(function() {
		$('#dataTables-example').dataTable();
	});
</script>
<script>
function DeleteData(id){
               var r = confirm("Are You Sure Delete Charges Catagory?");
               if (r==true){
                  $.ajax({
                     type: "POST",
                     url: "modules.php?file=delete_charge_catagories",
                     data:{did:id},
                     beforeSend : function () {
                     },
                     success:function(){
					 location.reload();
                     }
                  });
               }else{   
               }
            }
</script>
<style>
	.thclass{
	font-size:12px;
	}
	.tbclass{
	font-size:12px;
	}
</style>

	<div style="margin-left:12px; margin-top: 10px;">
		<p>
			<a class="btn btn-outline btn-primary btn-xs" id="act" href="modules.php?file=charge_catagories&mid=<? echo $mid;?>&smid=<? echo $smid;?>" >Add Charge Catagory</a>
			<a class="btn btn-outline btn-primary btn-xs" id="active" href="modules.php?file=view_charge_catagories&type=view&mid=<? echo $mid;?>&smid=<? echo $smid;?>" >View All Charges Catagories</a>&nbsp;
		</p>
	</div>
	
<div class="col-lg-12">
	<div class="panel panel-primary">
		
		<div class="panel-heading"><i class="fa fa-bell fa-fw"></i>charges catagories List</div>
		<div class="panel-body">
			<div class="table-responsive">
				<table class="table table-striped table-bordered table-hover" id="dataTables-example">
					<thead class="thclass">
						<tr>
							<th>Sr.No</th>
							<th>Id</th>
							<th>Name</th>
							<th>Description</th>
							<th>Is Published</th>
							<th>Order Number</th>
							<th>Edit</th>
							<th>Delete</th>
					</thead>
					<tbody class="tbclass">
					<?php 
					$intSnCount = 1;
					foreach( $arrobjChargeCatagories as $arrmixChargeCatagories ) {
							$n++;
					?>
							<tr class="odd gradeX">
							<td><?  echo $intSnCount; ?></td>
							<td><? echo $arrmixChargeCatagories->getId(); ?></td>
							<td><? echo $arrmixChargeCatagories->getName(); ?></td>
							<td><? echo $arrmixChargeCatagories->getDescription(); ?></td>
							<td><? echo $arrmixChargeCatagories->getIsPublished(); ?></td>
							<td><? echo $arrmixChargeCatagories->getOrderNumber(); ?></td>
							<td>
								<a href="modules.php?file=charge_catagories&charge_cat_id=<? echo $arrmixChargeCatagories->getId(); ?>&mid=<? echo $mid;?>&smid=<? echo $smid;?>"><img src="images/icons/update.png" width="25" height="25"></a>
							</td>
							<td>
								<a id="delete_charge_cat" onClick="DeleteData(<?echo $arrmixChargeCatagories->getId();?>);"><img src="images/icons/delete.jpg" width="25" height="25"></a>
							</td>
							</tr>
					<?
					} 
					?>
					</tbody>
				</table>
			</div>
		</div>
	</div>
</div>
<?php
}
?>